package com.monkey.util;

import org.springframework.stereotype.Component;

import java.util.List;
import java.util.UUID;

/**
 * desc:
 * auth: chenxiaobin
 * data: 2017/4/16.
 */
@Component
public class IDGenerator {
    public String randomUUID() {
        return UUID.randomUUID().toString().replace("-", "");
    }

    public int randomId() {
        // 返回100000-999999之间的随机数
        int ret = 0;
        while (ret < 99999) {
            int ret1 = (int) (Math.random() * 10000);
            int ret2 = (int) (Math.random() * 10000);
            ret = ret1 * ret2 % 1000000;
        }
        return ret;
    }
}
